
#ifndef __QUANTITY_H__
#define __QUANTITY_H__

template <class TUnit>
class Quantity
{
	friend class Length;
public:
	Quantity(int value, const TUnit& unitType):value_m(value),unitType_m(unitType)
	{
	}

 	bool operator != (const Quantity & rhs) const
	{
		return (toAmountInBaseUnit() != rhs.toAmountInBaseUnit());
	}

	Quantity operator + (const Quantity & rhs) const
	{
		return Quantity(toAmountInBaseUnit()+rhs.toAmountInBaseUnit(), TUnit::getBaseUnit());
	}
protected:
	int toAmountInBaseUnit() const
	{
		return unitType_m.toAmountInBaseUnit(value_m);
	}
private:
	int value_m;
	const TUnit& unitType_m;

};

#endif

